<template>
    <div class='newinfo-container'>
        <h3 class="title">{{newinfo.title}}</h3>
        <p class="subtitle">
            <span>发表时间：{{newinfo.add_time | dateFormat}}</span>
            <span>点击次数：{{newinfo.click}}</span>
        </p>
        
        <hr>

        <div class="content" v-html="newinfo.content"></div>
        <myComment :id = 'id'></myComment>
    </div>
</template>
<script>
import { Toast} from 'mint-ui'
import Comment from '../subcomponents/Comment.vue'
export default {
    data(){
        return {
            id:this.$route.params.id,
            newinfo: {}
        }
    },
    created(){
        this.getNewInfo();
    },
    methods:{
        getNewInfo(){
            this.$http.get('api/getnew/'+this.id).then(result =>{
                console.log(result.body)
                if(result.body.status === 0){
                    this.newinfo = result.body.message[0]
                }else{
                    Toast('获取new失败')
                }
            })
        }
    },
    components:{
        'myComment': Comment
    }
    
}
</script>
<style lang="scss" scoped>

</style>
